import 'package:flutter/material.dart';
import 'json.dart';
void main()=>runApp(MyApp());

class MyApp extends StatelessWidget{
  List<Widget> list = new List();
  List<Widget> _getData(){
    for(var i=0;i<30;i++){
      list.add(
        Container(
          color: Colors.blue,
          alignment: Alignment.center,
          child: Text("这是第 $i 条数据",
            style: TextStyle(
              color: Colors.white,
              fontSize: 20
            ),
          ),

        )
      );
    }
    return list;
}
  Widget build(BuildContext context){
    return MaterialApp(
      home:Scaffold(
        appBar: AppBar(
          title: Text("data",
          textAlign: TextAlign.right,
          ),
        ),
        body: GridView.count(
          crossAxisCount: 2,//控制一行多少个Widget
          mainAxisSpacing: 10,//子组件上下间距
          crossAxisSpacing: 10,//子组件左右间距
          padding: EdgeInsets.all(10),
          children: this._getData(),
        ),
      ),
    );
  }
}


